<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<link rel="stylesheet" href="static/css/product.css" />
<script type="text/javascript" src="static/js/jquery-1.8.3.min.js"></script>
<title>第二页面</title>
</head>
<body>

	<div class="header">
		<span class="header_font">中国电气网</span>
		<ul class="nav">
			<li><a href="index.jsp">网站首页</a></li>
			<li><a href="news.jsp">行业动态</a></li>
			<li><a href="">企业解决方案展示</a></li>
			<li><a href="product.jsp">企业产品展示</a></li>
			<li><a href="">求购信息</a></li>
		</ul>
	</div>
	<div class="header_after"></div>

	<div class="webContainer">
		<div class="center">
			<div class="containerFormsLeft">


				<div class="formMiddleCenter">
					<div class="bannerTextOutWrap">
						<span>产品展示 &nbsp;Product</span>
						<ul class="productss">
						</ul>
					</div>
				</div>


				<div class="formMiddleCenter">
					<div class="bannerTextOutWrap">
						<span>行业动态 &nbsp; News</span>

					</div>
				</div>


				<div class="formMiddleCenter">
					<div class="bannerTextOutWrap">
						<span>联系方式 &nbsp; Contact</span>
					</div>
				</div>


			</div>
			<!-- 菜单栏 -->
			<div class="menucenter">
				<div class="headere">
					<div class="locations">
						<div class="kuan">
							<span>当前位置：</span><a href="#">网站首页</a><span>>产品展示</span>
						</div>
					</div>
				</div>
				<div class="formMiddlecenter"></div>
				<div class="pagenation">
					<button id="first"  onclick="fenyeq()"
						disabled="disabled">上一页</button>
					第<input type="text" id="yeshu" style="width: 20px"
						disabled="disabled" value=1>页
					<button id="last"  onclick="fenye()">下一页</button>
				</div>
			</div>
		</div>
	</div>




	<div class="fk-moduleZoneWrap">
		<div class="footer">
			<div class="link_address_out">
				<div class="link_address_out_font">
					<span>友情链接</span>
					<div></div>
				</div>
				<div class="link_address_inner">
					<a href="http://www.ces.cn/" title="中国节能网" target="_blank"> <img
						alt="中国节能网" src="static/image/footer1.png" /></a> <a
						href="http://www.zhaoming.cn/" title="中国照明网" target="_blank">
						<img alt="中国照明网" src="static/image/footer2.png" />
					</a> <a href="http://www.cepn.cn/" title="中国环保网" target="_blank"> <img
						alt="中国环保网" src="static/image/footer3.png" /></a> <a
						href="http://www.yejin.cn/" title="中国冶金网" target="_blank"> <img
						alt="中国冶金网" src="static/image/footer4.png" /></a> <a
						href="http://www.huagong.cn/" title="中国化工网" target="_blank"> <img
						alt="中国化工网" src="static/image/footer5.png" /></a> <a
						href="http://www.ceceem.org/" title="中国能源研究会节能与企业能源管理专业委员会"
						target="_blank"> <img alt="中国能源研究会节能与企业能源管理专业委员会"
						src="static/image/footer6.png" /></a>
				</div>
			</div>
		</div>
	</div>

</body>
</html>
<script>
	var yamashu;
	var nub = $("#yeshu").val();
	window.onload = function() {
		getproducts();
	}
	function getproducts() {
		var body1 = "";
		var body2 = "";
		$.ajax({
			url : "productDisplay",//请求地址，其实就是我们servlet的映射名
			data : {
				"number" : nub
			},//限定返回（response）的参数类型,当你死都收不到返回值得时候，请把dataType属性改成text,打印一下看看是啥子
			dataType : "json",//限定返回（response）的参数类型
			type : "post",//提交方式
			async : false,//是否同步，如果为FALSE则可以将返回的值return出来，反之则不得行
			success : function(result, status) {
				yamashu = result.countall;
				console.log(yamashu);
				console.log(nub);
				if (yamashu == nub) {
					$("#last").attr("disabled", true);
				}
				$.each(result.list, function(i, entity) {
					body1 += "<div class='productp'>" + "<div class='pict'>"
							+ "<img src='static/image/" + entity.image
							+ "' style='height: 99%;width: 99% '/>"
							+ "</div><a class='productname'>"
							+ entity.product_name + "</a></div>";
					if (i < 5) {
						body2 += "<li><a href='#'>" + entity.product_name
								+ "</a></li>";
					}
				});
				$(".formMiddlecenter").html("");
				$(".productss").html("");
				$(".formMiddlecenter").append(body1);
				$(".productss").append(body2);
			}

		});
	}
	function fenye() {
		/*获取test框中的页码  */
		if (yamashu > nub) {
			nub++;
			$("#yeshu").val(nub);
			$("#first").attr("disabled", false);
			$(".formMiddlecenter").html("");
			getproducts();
		}

	}
	function fenyeq() {
		nub--;
		$("#yeshu").val(nub);
		getproducts();
		if (nub == 1) {
			$("#first").attr("disabled", true);
			$("#last").attr("disabled", false);
		} else {
			$("#last").attr("disabled", false);
		}
	}
</script>